﻿@model LandManager.Web.Service.ReportModel

@{
    ViewBag.Menu = "数据报表";

    int id = ViewBag.ID ?? 0;

    var name = id == 0 ? "新增" : "处置";

    Dictionary<string, int> getwayDic = ViewBag.GetWay;
    Dictionary<string, int> typeDic = ViewBag.Type;
    Dictionary<string, int> rangeDic = ViewBag.Range;

    var from = ViewBag.From ?? "";
    var to = ViewBag.To ?? "";
}

<script type="text/javascript" src="~/Scripts/jquery-ui-1.8.24.min.js"></script>
<link href="~/Content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
    $(function () {
        $("#fromDate, #toDate").datepicker({
            closeText: '关闭',
            prevText: '<上月',
            nextText: '下月>',
            currentText: '今天',
            monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
            '七月', '八月', '九月', '十月', '十一月', '十二月'],
            monthNamesShort: ['一', '二', '三', '四', '五', '六',
            '七', '八', '九', '十', '十一', '十二'],
            dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
            dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
            dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
            weekHeader: '周',
            dateFormat: 'yy-mm-dd',
            firstDay: 1,
            isRTL: false,
            showMonthAfterYear: true,
            yearSuffix: '年',
            defaultDate: new Date(),
            onSelect: function () { }
        });
    });
</script>
<script type="text/javascript" src="~/Scripts/jquery.PrintArea.js"></script>
<script type="text/javascript">
    $(function () {
        $("input#reportBtn").click(function () {
            $("div#reportDIV").printArea({
                mode: 'popup'
            });
        });
        if ("@from" != "" && "@to" != "") {
            $("#fromDate").val("@from");
            $("#toDate").val("@to");
        }
    });

    function submitForm() {
        var start = $('#fromDate').val();
        var end = $('#toDate').val();
        if (start == "") {
            alert("开始时间不能为空");
            return;
        }
        if (end == "") {
            alert("结束时间不能为空");
            return;
        }

        if (start > end) {
            alert("开始时间不能大于结束时间");
            return;
        }
        $("#myform").submit();
    }

</script>

<div style="width: 1050px; margin: auto auto">
    <form id="myform" action="~/Land/Report/@id" method="post">
        <input name="IsHandle" type="hidden" value=@id />
        <table style="width: 100%; text-align: center; vertical-align: central">

            <tr>

                <td style="width: 175px; height: 30px"></td>
                <td>
                    @*<p style="font-weight: bold; margin-bottom: 0px; margin-top: 0px">中国航空工业公司处置土地信息统计表</p><br />*@
                    <p></p>
                    <p style="font-size: 0.8em; margin-top: 0px"> 
                    开始时间：<input id="fromDate" name="from" type="text" class="txt110" />
                    结束时间：<input id="toDate" name="to" type="text" class="txt110" />
                        <input id="queryBtn" class="aSty" type="button" onclick="submitForm()" value="查询" />
                        <input id="reportBtn" class="aSty" type="button" value="打印" />
                    </p>
                </td>
                @*<td><input id="queryBtn" class="btnSty_search" type="button" onclick="submitForm()" title="查询" /></td>

                <td>
                    <input id="reportBtn" class="btnSty_print" type="button" title="导出" />
                </td>*@
            </tr>
        </table>
    </form>
    <br />
    <div id="reportDIV">

        <style type="text/css">
            .btnSty {
                width: 120px;
                height: 28px;
                margin: 0px 10px auto auto;
                vertical-align: central;
            }

            .btnSty_search {
                width: 32px;
                height: 32px;
                /*margin: 0px 10px auto auto;*/
                vertical-align: central;
                background: url(../../images/btn_search_press.png) no-repeat;
                background-size: cover;
                border: 0px;
                cursor: pointer;
            }

            .btnSty_print {
                width: 32px;
                height: 32px;
                /*margin: 0px 10px auto auto;*/
                vertical-align: central;
                background: url(../../images/btn_start_press.png) no-repeat;
                background-size: cover;
                border: 0px;
                cursor: pointer;
            }

            .tb1 {
                margin-top: 15px;
                width: 80%;
                table-layout: fixed;
                border: solid #9D9D9D;
                border-width: 1px 0px 0px 1px;
                margin-left: 150px;
            }

            .tb2 {
                table-layout: fixed;
                border: solid #9D9D9D;
                border-width: 0px 0px 0px 1px;
                margin-left: 150px;
                width: 80%;
            }

            .td35 {
                width: 32px;
                height: 22px;
                text-align: center;
                vertical-align: central;
                border: solid #9D9D9D;
                border-width: 0px 1px 1px 0px;
                font-size: 0.8em;
            }

            .td50 {
                width: 47px;
                height: 22px;
                text-align: center;
                vertical-align: central;
                border: solid #9D9D9D;
                border-width: 0px 1px 1px 0px;
                font-size: 0.8em;
            }

            .td190 {
                width: 190px;
                height: 22px;
                text-align: center;
                vertical-align: central;
                border: solid #9D9D9D;
                border-width: 0px 1px 1px 0px;
                font-size: 0.8em;
            }

            .td200 {
                width: 200px;
                height: 22px;
                text-align: center;
                vertical-align: central;
                border: solid #9D9D9D;
                border-width: 0px 1px 1px 0px;
                font-size: 0.8em;
            }

            .td235 {
                width: 235px;
                height: 22px;
                text-align: center;
                vertical-align: central;
                border: solid #9D9D9D;
                border-width: 0px 1px 1px 0px;
                font-size: 0.8em;
            }

            .td250 {
                width: 250px;
                height: 22px;
                text-align: center;
                vertical-align: central;
                border: solid #9D9D9D;
                border-width: 0px 1px 1px 0px;
                font-size: 0.8em;
            }

            .tdheader {
                width: 100%;
                height: 27px;
                text-align: left;
                vertical-align: central;
                border: solid #9D9D9D;
                border-width: 0px 1px 1px 0px;
                font-size: 0.9em;
                font-weight: bold;
            }

            .aSty {
                width: 130px;
                height: 32px;
                line-height: 32px;
                vertical-align: central;
                margin: auto auto auto 10px;
                text-align: center;
                vertical-align: central;
                text-align: center;
                background: #2573c7;
                color: #fff;
                border: 0px;
                cursor: pointer;
                display: inline-block;
                text-decoration: none;
            }
        </style>

        @{
            if (Model != null && Model.LandCount > 0)
            {
                <table id="reportTable" class="tb1" cellspacing="0">
                    <tr><td colspan="3" class="tdheader" style="text-align: center;">中国航空工业公司 @name 土地信息统计表</td></tr>
                    <tr>
                        <td colspan="3" class="tdheader">一、@name 土地基本情况</td>
                    </tr>
                    <tr>
                        <td class="td190">土地宗数</td>
                        <td class="td250">@Model.LandCount</td>
                        <td class="td235">宗</td>
                    </tr>
                    <tr>
                        <td class="td190">土地面积</td>
                        <td class="td250">@Model.LandArea</td>
                        <td class="td235">平方米</td>
                    </tr>
                    <tr>
                        <td class="td190">账面原值</td>
                        <td class="td250">@Model.LandPrice</td>
                        <td class="td235">万元</td>
                    </tr>
                </table>


                <table class="tb2" cellspacing="0">
                    @{
                if (getwayDic != null)
                {
                    <tr>
                        <td colspan="5" class="tdheader">二、@name 土地获取方式</td>
                    </tr>

                    foreach (var item in getwayDic.Keys)
                    {
                        <tr>
                            <td class="td190">@item</td>
                            <td class="td200">@getwayDic[item]</td>
                            <td class="td50">平方米</td>
                            <td class="td200">@(((getwayDic[item] / Decimal.Parse(Model.LandArea.ToString())) * 100).ToString("0.00"))</td>
                            <td class="td35">%</td>
                        </tr>
                    }
                }
                    }



                    @{
                if (typeDic != null)
                {
                    <tr>
                        <td colspan="5" class="tdheader">三、@name 土地性质</td>
                    </tr>
                    foreach (var item in typeDic.Keys)
                    {
                        <tr>
                            <td class="td190">@item</td>
                            <td class="td200">@typeDic[item]</td>
                            <td class="td50">平方米</td>
                            <td class="td200">@(((typeDic[item] / Decimal.Parse(Model.LandArea.ToString())) * 100).ToString("0.00"))</td>
                            <td class="td35">%</td>
                        </tr>
                    }
                }
                    }


                    @{
                if (rangeDic != null)
                {
                    <tr>
                        <td colspan="5" class="tdheader">四、@name 土地分布情况</td>
                    </tr>

                    foreach (var item in rangeDic.Keys)
                    {
                        <tr>
                            <td class="td190">@item</td>
                            <td class="td200">@rangeDic[item]</td>
                            <td class="td50">平方米</td>
                            <td class="td200">@(((rangeDic[item] / Decimal.Parse(Model.LandArea.ToString())) * 100).ToString("0.00"))</td>
                            <td class="td35">%</td>
                        </tr>
                    }

                }
                    }
                </table>
            }
        }
        <br />
    </div>
</div>
